From c48e6daa41b41945d4c42950ddc179f05ef439ca Mon Sep 17 00:00:00 2001 From: Igor Matuszewski Date: Tue, 22 Aug 2017 17:13:00 +0200 Subject: [PATCH] Add `fn args_replace` and `fn get_program` to `ProcessBuilder` --- src/cargo/util/process_builder.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/cargo/util/process_builder.rs b/src/cargo/util/process_builder.rs index 6386be9de..704275d8c 100644 --- a/src/cargo/util/process_builder.rs +++ b/src/cargo/util/process_builder.rs @@ -45,6 +45,13 @@ impl ProcessBuilder { self } + pub fn args_replace>(&mut self, arguments: &[T]) -> &mut ProcessBuilder { + self.args = arguments.iter().map(|t| { + t.as_ref().to_os_string() + }).collect(); + self + } + pub fn cwd>(&mut self, path: T) -> &mut ProcessBuilder { self.cwd = Some(path.as_ref().to_os_string()); self @@ -61,6 +68,10 @@ impl ProcessBuilder { self } + pub fn get_program(&self) -> &OsString { + &self.program + } + pub fn get_args(&self) -> &[OsString] { &self.args } -- 2.30.2